<?php ob_start() ?>

<div class="jumbotron">
    <div class="container">
        <?php if (isset($_SESSION['betporra_msj'])) { ?>
            <div class="alert alert-success alert-dismissable col-lg-12 text-center">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <?php echo $_SESSION['betporra_msj'] ?>
            </div>
            <?php
            unset($_SESSION['betporra_msj']);
        }

        //Si no hay porras mostramos un mensaje
        if ($num_porras == 0) {
            ?>
            <div class="text-center">
                <h1><i class="fa fa-warning"></i> <?php echo LABEL_PORRASNOHAY ?></h1>
            </div>
        <?php } else { ?>
            <div class="text-center" style="margin-bottom: 20px;">
                <h1><i class="fa fa-trophy"></i> <?php echo $params_porra[0]['competicion_nombre'] ?></h1>
            </div>

            <?php foreach ($params as $param) {
                ?>
                <div class="row panel panel-body animated fadeInDownBig">
                    <div class="col-lg-12 text-center">
                        <div class="col-lg-4"  style="margin-bottom: 15px;">
                            <p class="label label-primary"><?php echo $param['descripcion'] ?></p>
                        </div>
                        <div class="col-lg-4">
                            <p class=""><i class="fa fa-calendar-o"></i> <?php echo date("d-m-Y H:i", strtotime($param['fecha'])); ?></p>
                        </div>
                        <div class="col-lg-4">
                            <p class=""><img src="web/images/ficha-min.png" height="25" class="fa-spin" style="vertical-align: text-bottom;"/> <?php echo LABEL_PORRASBOTE ?> <?php echo $param['bote_porra'] ?> <small>bp</small></p>
                        </div>
                    </div>
                    <div class="col-lg-12 text-center">

                        <div class="col-lg-12 well">
                            <?php
                            $cont = 1;
                            foreach ($param['partidos'] as $param_partido) {
                                if ($param_partido['pronosticos']['id'] == '') {
                                    ?>
                                    <form action = "apostar" method = "post" name = "form_apuesta" accept-charset = "UTF-8" role = "form">
                                        <div class = "col-lg-12">

                                            <div class = "col-lg-12 text-center">
                                                <h4><i class="fa fa-calendar"></i> <?php echo date("d-m-Y H:i", strtotime($param_partido['fecha'])); ?></h4>
                                            </div>
                                            <div class="col-lg-12 text-center">
                                                <div class="col-lg-1"><img src="web/images/clubs/<?php echo $param_partido['equipo_local_escudo'] ?>" width="40" class="list-inline"></div>
                                                <div class="col-lg-2"><h4><?php echo $param_partido['equipo_local_nombre'] ?></h4></div>
                                                <div class="col-lg-6">
                                                    <h4>
                                                        <input type="text" name="local<?php echo $cont; ?>" data-slider="true" data-slider-range="0,5" data-slider-step="1" data-slider-snap="true" data-slider-theme="volume" class="slider data-slider-left">
                                                        <b>vs&nbsp;</b> 
                                                        <input type="text" name="visitante<?php echo $cont; ?>" data-slider="true" data-slider-range="0,5" data-slider-step="1" data-slider-snap="true" data-slider-theme="volume" class="slider data-slider-right">
                                                    </h4>
                                                </div>
                                                <div class="col-lg-2"><h4><?php echo $param_partido['equipo_visitante_nombre'] ?></h4></div>
                                                <div class="col-lg-1"><img src="web/images/clubs/<?php echo $param_partido['equipo_visitante_escudo'] ?>" width="40"></div>
                                                <hr>
                                                <input name="partido<?php echo $cont; ?>" type="hidden" value="<?php echo $param_partido['id']; ?>">
                                                <input name="competicion" type="hidden" value="<?php echo $_GET['id']; ?>">
                                            </div>
                                            <div class="col-lg-12">
                                                <p style="height: 1px ;margin: 9px 0;overflow: hidden;background-color: #e5e5e5;"></p>
                                            </div>
                                        </div>
                                    <?php } else {
                                        ?>
                                        <div class = "col-lg-12">
                                            <form action = "apostar" method = "post" name = "form_apuesta" accept-charset = "UTF-8" role = "form">
                                                <div class = "col-lg-12 text-center">
                                                    <h4><i class = "fa fa-calendar"></i> <?php echo date("d-m-Y H:i", strtotime($param_partido['fecha'])); ?></h4>
                                                </div>
                                                <div class="col-lg-12 text-center">
                                                    <div class="col-lg-1"><img src="web/images/clubs/<?php echo $param_partido['equipo_local_escudo'] ?>" width="40" class="list-inline"></div>
                                                    <div class="col-lg-2"><h4><?php echo $param_partido['equipo_local_nombre'] ?></h4></div>
                                                    <div class="col-lg-6">
                                                        <h4>
                                                            <span class="text-success fa-2x"><?php echo $param_partido['pronosticos']['goles_local'] ?></span>
                                                            <span class="text-success fa-1x"><b>&nbsp;vs&nbsp;</b> </span>
                                                            <span class="text-success fa-2x"><?php echo $param_partido['pronosticos']['goles_visitante'] ?></span>
                                                        </h4>
                                                    </div>
                                                    <div class="col-lg-2"><h4><?php echo $param_partido['equipo_visitante_nombre'] ?></h4></div>
                                                    <div class="col-lg-1"><img src="web/images/clubs/<?php echo $param_partido['equipo_visitante_escudo'] ?>" width="40"></div>

                                                </div>
                                                <div class="col-lg-12"><hr></div>
                                        </div>
                                    <?php } ?>

                                    <?php
                                    $cont++;
                                }
                                ?>
                                <?php if (empty($param_partido['pronosticos'])) { ?>
                                    <div class="btn-group col-lg-2 col-lg-offset-5">
                                        <input class="btn  btn-block btn-lg btn-primary" type="submit" value="<?php echo LABEL_PORRASAPOSTAR ?>" style="">
                                    </div>
                                <?php } ?>
                            </form>
                        </div><!-- /.col-lg-12 well-->
                        <div class="well">
                            <span style="color: #57a957;font-weight: bold;"><?php echo LABEL_JUGANDO ?> </span>
                            <?php if (count($param['usuarios']) > 5) { ?>
                                <span class="badge"><?php echo (count($param['usuarios']) - 5) ?>+ </span>
                            <?php } ?>
                            <?php
                            $contuser = 0;
                            foreach ($param['usuarios'] as $param) {
                                if ($contuser == 5) {
                                    break;
                                }
                                ?>
                                <img src="web/images/users/<?php echo $param['imagen'] ?>" width="40" height="40" class="img-circle" title="<?php echo $param['usuario']; ?>"/>
                                <?php
                                $contuser++;
                            }
                            ?>
                        </div> <!-- .well -->
                    </div><!-- /.col-lg-12 -->
                </div><!-- /.row -->
                <?php
            }
        }
        ?>
    </div><!-- /.container -->
</div><!-- /.jumbotron -->


<?php
$contenido = ob_get_clean();
include 'app/templates/plantilla_privada.php';
?>

